<?php
require_once '../../Lib/main.php';
try {
	$id = null;
	if (isset($_REQUEST['id']) && trim($_REQUEST['id']) !== '') {
		$id = $_REQUEST['id'];
	}
	
	
	$proclssDAO = new Dao_ProductClassDAO();
	$listProdclss = $proclssDAO->getProductClassByCategoryId($id);
	$arr = array();
	foreach ($listProdclss as $key => $prodclass) {
		$inArr = array();
		$inArr['id'] = $prodclass->getId();
		$inArr['name'] = $prodclass->getNameClass();
		$arr[] = $inArr;
	}

	echo json_encode(array('success' => true, 'items' => $arr));

} catch (Exception $e) {
	echo json_encode(array('success' => false,'error' => $e->getMessage()));
}